using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class forums_controls_usercp_ActiveUsers :  Controls.BaseControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            Refresh();
        }
    }

    protected override void UserLoggedIn(object sender, EventArgs e)
    {
        Refresh();
    }

    protected override void UserLoggedOut(object sender, EventArgs e)
    {
        Refresh();
    }

    private void Refresh()
    {
        gridUsers.DataSource = DAL.Users.GetActiveUsers();
        gridUsers.DataBind();
    }

    protected bool IsAdmin(DAL.User user)
    {
        return user != null && user.HasPermissions(DAL.User.UserStatus.Administrator);
    }

    protected bool IsMod(DAL.User user)
    {
        return user != null && user.HasPermissions(DAL.User.UserStatus.Moderator);
    }
}
